<?php
	$tour = new Tour();
	$tour->select($tour_id);
	
	/*
	// delete thm_picture
	$thm_picture = new Picture();
	if ($thm_picture_id = $tour->getthm_picture()) {
		$thm_picture->select($thm_picture_id);
		$thm_picture->deleteAllFiles();
		$thm_picture->delete($tour->getthm_picture());
	}
	
	// delete ads_picture
	$ads_picture = new Picture();
	if ($ads_picture_id = $tour->getads_picture()) {
		$ads_picture->select($ads_picture_id);
		$ads_picture->deleteAllFiles();
		$ads_picture->delete($tour->getads_picture());
	}
	
	// delete pictures
	$pictures = $tour->getAllPictures();
	if ($pictures)
		foreach ($pictures as $picture) {
			$picture->deleteAllFiles();
			$picture->delete($picture->getid());
		}
		
	// delete tour location
	$locations = $tour->getAllLocations();
	if ($locations)
		foreach ($locations as $location) {
			$tour_location = TourLocation::retriveByTourAndLocation($tour_id, $location->getid());
			if ($tour_location)
				$tour_location->delete($tour_location->getid());
		}
		
	// delete tour category
	$categories = $tour->getAllTourCategories();
	if ($categories)
		foreach ($categories as $category) {
			$tour_category = TourCategory::retriveByTourAndCategory($tour_id, $category->getid());
			if ($tour_category)
				$tour_category->delete($tour_category->getid());
		}
	// delete tour object*/
	$tour->setactive(0);
	$tour->update();
?>